package cn.wolfcode.trip.base.domain;

import com.alibaba.druid.support.json.JSONUtils;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.util.HashMap;

/**
 * 大攻略
 */
@ToString
@Getter
@Setter
@JsonIgnoreProperties(value = {"json"})
public class Strategy extends BaseDomain{
    public static final int STATE_MORMAL = 0; // 普通
    public static final int STATE_HOT = 1; // 热门
    public static final int STATE_DISABLE = -1; // 禁用
    //地区
    private Region place;
    //标题
    private String title;
// 副标题
    private String subTitle;
//  封面
    private String coverUrl;
// 攻略的状态
    private Integer state = STATE_MORMAL;
    //攻略点赞条数
    private Integer likeNum;
    public String getStateName(){
        String tempString="";
        switch (state){
            case STATE_MORMAL:
                tempString ="普通";
                break;
            case STATE_HOT:
                tempString ="热门";
                break;
            case STATE_DISABLE:
                tempString ="禁用";
                break;
        }
        return tempString;
    }
    public String getJson(){
        HashMap<String, Object> map = new HashMap();
        map.put("id",id);
        map.put("title",title);
        map.put("subTitle",subTitle);
        map.put("coverUrl",coverUrl);
        map.put("state",state);
        map.put("placeId",place.getId());
        return JSONUtils.toJSONString(map);
    }
}